package com.gxa.autoparts.admin.service.impl;

import com.gxa.autoparts.admin.mapper.ArticleMapper;
import com.gxa.autoparts.admin.service.ArticleService;
import com.gxa.autoparts.core.pojo.Article;
import com.gxa.autoparts.core.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @author Bei
 * @date 2022/1/6 9:58
 */
@Service("articleService")
@Transactional(rollbackFor = Throwable.class)
public class ArticleServiceImpl extends BaseServiceImpl<Article> implements ArticleService{

    @Autowired
    ArticleMapper articleMapper;

    @Override
    public Integer insertArticle(String title, String context) {
        Article article = new Article();
        article.setTitle(title);
        article.setContext(context);
        article.setTime(new Date());
        int i = articleMapper.insertSelective(article);
        return i;
    }
}
